<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>账户设置</title>
</head>
<body class="layui-layout-body">
<div class="layui-body">
        <!-- 内容主体区域 -->
        <div class="body_right">
            <h4 class="nav_title">账户设置</h4>
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		        <ul class="layui-tab-title">
		            <li class="layui-this">个人信息修改</li>
		            <li lay-id="CHANGE_PASSWORD">密码重置</li>
		        </ul>
		        <div class="layui-tab-content" >
            		<div class="layui-tab-item layui-show">
            				<form class="layui-form">
			            		<input type="hidden" name="partyId" value="${person.partyId}">
			                    <div class="layui-form-item">
			                        <label class="layui-form-label"></label>
			                        <div class="layui-input-inline layui-form-mid layui-word-aux">
			                        		<div style="display: flex;">
			                        			<a href="javascript:openwinx('上传头像','/personal/upportrait.htm',650,550);">
						                		 <img style="width: 90px;height: 90px;border-radius: 45px;" id="portraitView" src="${person.portrait!'/asset/images/portrait.png'}" title=点击上传>
						                		</a>
						                		<input type="hidden" name="portrait" id="portrait" value="${person.portrait}">
						                	</div>
			                        </div>
			                    </div>
			                    <div class="layui-form-item">
			                        <label class="layui-form-label">手机/账户</label>
			                        <div class="layui-input-inline layui-form-mid layui-word-aux">
			                        	${person.userLoginId}
			                        </div>
			                    </div>
			                    <div class="layui-form-item">
			                        <label class="layui-form-label">姓名</label>
			                        <div class="layui-input-inline">
			                            <input type="text" name="name" id="name" placeholder="请输入姓名" value="${person.name}" required="" lay-verify="name" autocomplete="off" class="layui-input">
			                        </div>
			                    </div>
			                    
			                    <div class="layui-form-item">
			                        <label class="layui-form-label">性别</label>
			                        <div class="layui-input-block">
								      <input type="radio" name="gender" value="MALE" title="男" <#if person.gender='MALE'>checked="" </#if>>
								      <input type="radio" name="gender" value="FEMALE" title="女" <#if person.gender='FEMALE'>checked="" </#if>>
								      <input type="radio" name="gender" value="UNKNOWN" title="未知" <#if person.gender='UNKNOWN'>checked="" </#if>>
								    </div>
			                    </div>
			                    
			                    <div class="layui-form-item">
			                        <label class="layui-form-label">邮箱</label>
			                        <div class="layui-input-inline">
			                            <input type="text" name="email" id="email" placeholder="请输入邮箱地址" value="${person.email}" required="" lay-verify="email" autocomplete="off" class="layui-input">
			                        </div>
			                    </div>
			                    
			                    <div class="layui-form-item">
			                        <label class="layui-form-label"></label>
			                        <div class="layui-input-inline">
			                            <button  class="layui-btn" lay-filter="add" lay-submit="">确认修改</button>
			                        </div>
			                    </div>
			            </form>
            		
            		</div>
            	</div>
        </div>
   <script>
        layui.use(['form','layer','element'], function(){
            $ = layui.jquery;
          var form = layui.form,element=layui.element
          ,layer = layui.layer;
        
          //自定义验证规则
          form.verify({
            name: function(value){
              if(!value){
                return '请输入姓名';
              }
            }
            ,mobile: function(value){
                if(!value){
                    return '请输入手机号';
                }
            }
           
          });
          
          element.on('tab(docDemoTabBrief)', function(elem){
		  		var id = $(this).attr('lay-id');
		  		if(id == 'CHANGE_PASSWORD'){
		  		 	location.href='/personal/editPassword.htm';
		  		}
		  });
          
          
          form.on('submit(add)', function(data){
          
          	 $.ajax({
	      			type:"POST", 
	      			url:"/personal/modify.htm",
	      			data:data.field ,
	      			success:function(result) {
			      
			      		if(result.code=='1'){
			      			layer.alert("修改成功", {icon: 6},function () {
			      				location.reload();
				            });
			      		}else{
			      		 	layer.msg(result.msg,{icon: 2});
			      		 	
			      		}
			      
			    	 } 
			    }); 
          
          
          
         	 return false;
          }); 
          
          
          
        });
    </script>
</body>
</html>